package com.jframe.app.action;

import java.util.ArrayList;
import java.util.List;
import com.jframe.app.model.App;
import com.jframe.sys.controller.ExtendAction;
import com.jframe.sys.controller.utils.JsBuilder;
import com.jframe.sys.utils.*;
import com.jframe.sys.webui.*;

public class AppAction extends ExtendAction {
	private static String SERVICE = "appService";
	private static Class<App> CLAZZ = App.class;

	public void list(){
		List<Columns> frozenColumns = new ArrayList<Columns>();// 固定列
		List<Columns> commonColumns = new ArrayList<Columns>();// 活动列
		
		frozenColumns.add(new Columns("ck", "", 40, ""));
		commonColumns.add(new Columns("id", "编号", 100, ""));
		commonColumns.add(new Columns("code", "权限代码", 100, ""));
		commonColumns.add(new Columns("name", "名称", 120, ""));
		commonColumns.add(new Columns("srcname", "包名", 120, ""));
		commonColumns.add(new Columns("srcPath", "源码路径", 200, ""));
		commonColumns.add(new Columns("pagePath", "页面路径", 200, ""));		
		commonColumns.add(new Columns("memo", "描述", 150, ""));		
		Grid grid = new Grid();
		grid.setUrl("appAction.do?method=load");
		String js = JsBuilder.getJsStr(frozenColumns, commonColumns, grid);
		this.request.setAttribute("js", js);
		this.forward("/jframe/app/list/appList.jsp");
	}

	public void load() {
		this.baseLoad(SERVICE, CLAZZ);
	}

	public void save() {
		this.baseSave(SERVICE, CLAZZ);
	}

	public void delete() {
		this.baseDelete(SERVICE);
	}

	public void getObjById() {
		this.print(JsonUtil.obj2Json(this.getObject(SERVICE)));
	}

}
